<%@ page import="java.util.*,com.release.utils.*,java.text.*,java.io.*,com.release.bean.*" %>
<%

try {
		 session = request.getSession();
		//	System.out.println("user_id..main" +session.getAttribute("USER_ID"));

//	temporary removed enable this line for login, and remove if(false){
/*
  if (session.getAttribute("USER_ID") == null || !((String) session.getAttribute("SESSION_ID")).equals(session.getId())) {

				try {
					response.sendRedirect("LoginPage.jsp");
				} catch (IOException ioe) {
					ioe.printStackTrace();
				}
	
			} 
			else
	*/
	{
			
		String usergroupname = (String)session.getAttribute("USER_GROUP_NAME"); 
		//DBUtil dbutil = new DBUtil(getServletContext());
		DBUtil dbutil = new DBUtil();
		String userid = (String)session.getAttribute("USER_ID")==null?"":(String)session.getAttribute("USER_ID");
		userid ="joju.varghese@cgi.com";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>

function insertpath(indId)
	{
		//document.treelist.objectName.value=indId;
		var repostr = document.getElementById("repo").value;
		var real =indId.replace(repostr+"/","");
		document.addRelease.objectName.value=real;

	}
	
	function openZoomPopUp(obj){
	  var ExURL = "./FileListServlet";
	  ExHandle = window.open(ExURL,"FileList","width=1000,height=300","resize=yes","screenX=130","screenY=10");
	}

		  function trim(sString)
		  {
			sTrimmedString = "";
		   if (sString != "") {
			  var iStart = 0;
			  var iEnd = sString.length - 1;
			 // var sWhitespace = " \t\f\n\r\v";
			 var sWhitespace = "   ";


			  while (sWhitespace.indexOf(sString.charAt(iStart)) != -1) {
				 iStart++;
				 if (iStart > iEnd) 
					break;
			  }

			  // If the string not just whitespace
			  if (iStart <= iEnd) {
				 while (sWhitespace.indexOf(sString.charAt(iEnd)) != -1)
					iEnd--;
				 sTrimmedString = sString.substring(iStart,++iEnd);
			  }
		   }
		   return sTrimmedString;
		 }



		 	function showFiles(o)
		{
		var opassitem = document.getElementById(o);
		//alert(event.srcElement.value);
		//var imgname = "img" + o;
		//var imgAct = document.all(imgname);
		if (opassitem.style.visibility == "hidden")
		{
			opassitem.style.visibility = "visible";
			//imgAct.src = "../images/plus.gif";
		}
	/*	else
		{
			opassitem.style.visibility = "hidden";
			//imgAct.src = "./images/minus.gif";
		}*/
		}
	function hideFiles(o){
		var opassitem = document.getElementById(o);
		if (opassitem.style.visibility == "visible")
		{
			opassitem.style.visibility = "hidden";
			//imgAct.src = "./images/minus.gif";
		}
	}
		
	function unHider()
	{
	
		document.addRelease.submit();
	}
	
	

	
		



		function addRow()
		{
			document.addRelease.releaseName.value =trim(document.addRelease.releaseName.value);
			document.addRelease.objectName.value =trim(document.addRelease.objectName.value);
			document.addRelease.userUpdated.value =trim(document.addRelease.userUpdated.value);
			document.addRelease.dateUpdated.value =trim(document.addRelease.dateUpdated.value);
			alert("objectName :"+document.addRelease.objectName.value);
			//document.addRelease.CRDetails.value =trim(document.addRelease.CRDetails.value);
			document.addRelease.act.value="addRow";
			document.addRelease.submit();
			
		}

		function cl(t){
			if (t.defaultValue==t.value) 
				t.value = '';
			}

		function submitForms(obj, obj2){
		  	
					// alert("obj.value.length"+obj.value);
			
				obj.value = trim(obj.value);
	
				 if( obj2.value == 0){
					alert("Please select object type.");
					obj2.focus();
					return false;
				 }
				
				
				if (obj.value.length == 0 )
				{
					alert("Please enter Object Name.");
					obj.focus();
					return false;
				 }

				

			
				return true;
				//  document.updateRelease.submit();
				//  document.searchReleaseForm.submit();
	
				//document.displayForm.submit();
		  	
		  				//  document.MainForm.submit();
						//alert("HIIIIIII");
		} 	
		

		

				function submitForms2(obj, obj2, obj3){
		  	
					// alert("obj.value.length"+obj.value);
			
				obj.value = trim(obj.value);
	
				if (obj.value.length == 0 )
				{
					alert("Please enter Object Name.");
					obj.focus();
					return false;
				 }

				 if( obj2.value == 0){
					alert("Please select object type.");
					obj2.focus();
					return false;
				 }

				 if( obj3.value == ''){
					alert("Please enter index for new table.");
					obj3.focus();
					return false;
				}
			
				return true;
				//  document.updateRelease.submit();
				//  document.searchReleaseForm.submit();
	
				//document.displayForm.submit();
		  	
		  				//  document.MainForm.submit();
						//alert("HIIIIIII");
		} 	
		
		function checklengthtovalidate(str, formComponent){
		
			if(str.length > 250) {
				alert("Sorry, You can not enter more then 250 characters");
				formComponent.focus();
				return false;
			}
			else { 
				return true;
			}
		}

		function delRow(num)
		{
			
			document.addRelease.delNumber.value=num;
			document.addRelease.act.value="delRow";
			
			//alert(document.addRelease.delNumber.value);
			document.addRelease.submit();
		}
		function save()
		{
			
			document.addRelease.act.value="save";
			//document.addRelease.action="Save.do";
			document.addRelease.submit();
		}
		function saveandsend()
		{
			
			document.addRelease.act.value="saveandsend";
			document.addRelease.submit();
		}
	
	</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Sql Script</title>
<style type="text/css">
<!--
body {
	background-image: url(./images/bg/pagebg.gif);
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
}
-->
</style>
<script type="text/javascript">
<!--
//-->
</script>
<link href="joju.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style4 {color: #FFFFFF}
-->
</style>
</head>

<body >
<form name="addRelease" method="post"  >
<center>
  <table id="Table_01" width="1002" height="778" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="101" align="left" valign="top"><img src="./images/index_01.jpg" width="1002" height="101" alt="" /></td>
    </tr>
    <tr>
      <td height="46" align="left" valign="top"><table id="Table_3" width="1002" height="46" border="0" cellpadding="0" cellspacing="0">
      </table></td>
    </tr>
    <tr>
      <td height="631" align="left" valign="top"><table id="Table_" width="1002" height="595" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="2" bgcolor="#A1C0DF"><img src="./images/content_01.jpg" width="226" height="1" alt="" /></td>
            <td><img src="./images/content_02.jpg" width="776" height="1" alt="" /></td>
          </tr>
          <tr>
            <td height="574" valign="top" bgcolor="#A1C0DF">&nbsp;</td>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="835" colspan="5" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="3%">&nbsp;</td>
                      <td width="97%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td><table id="Table_2" width="736" height="251" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="11"><img src="./images/login_01.jpg" width="11" height="11" alt="" /></td>
                          <td width="713" background="./images/login_02.jpg"><img src="./images/login_02.jpg" width="384" height="11" alt="" /></td>
                          <td width="12"><img src="./images/login_03.jpg" width="12" height="11" alt="" /></td>
                        </tr>
                        <tr>
                          <td background="./images/login_02.jpg"><img src="./images/login_04.jpg" width="11" height="224" alt="" /></td>
                          <td align="left" valign="top" background="./images/bg/loginbg.jpg">
							<input type=hidden name="act" value="" >
		<input type=hidden name="delNumber" value="" >
		<%
			String act =(String) request.getParameter("act");
			boolean sendmailfailflag=false;
			boolean saveflag=false;
			Vector allRel=null;
			Vector tempVector= new Vector();
			Vector ContactPersonVector = new Vector();
			ReleaseVO tempVo = null;
			java.text.SimpleDateFormat jsformatter =  new java.text.SimpleDateFormat("d MMM yyyy");
			String todate = jsformatter.format(new java.util.Date());
			String relname = (String)request.getParameter("releaseName")==null?"":request.getParameter("releaseName");
			//String extraIndex = request.getParameter("extraIndex")==null?"":request.getParameter("extraIndex");
			String extraIndex =new String ("NOTSET");
			String objTypeforIndx = request.getParameter("objectType")==null?"":request.getParameter("objectType");
			String dbNameforIndx = request.getParameter("dBName")==null?"":request.getParameter("dBName");
			String relNameforIndx = request.getParameter("releaseName")==null?"":request.getParameter("releaseName");
			String contactPerson = request.getParameter("contactPerson")==null?"":request.getParameter("contactPerson");

			if(session.getAttribute("CONTACTPERSONVECTOR")!=null){
				ContactPersonVector = (Vector)session.getAttribute("CONTACTPERSONVECTOR");
			}

			if(contactPerson!=null && !(contactPerson.equals(""))){
				
				if(!(ContactPersonVector.contains(contactPerson))){
					ContactPersonVector.add(contactPerson);
				}

				session.removeAttribute("CONTACTPERSONVECTOR");
				session.setAttribute("CONTACTPERSONVECTOR", ContactPersonVector	);
			}

			boolean extraIndxFlag = false;	
			boolean ManadatoryCRFlag = false;

			if(objTypeforIndx.equals("New Table") && dbutil.checkForIndex(dbNameforIndx)){
				extraIndxFlag = true;
			}

			if(dbutil.checkForCRDetail(objTypeforIndx)){
				ManadatoryCRFlag = true;			
			}


			if( act == null )
			{
				
			//	System.out.println("ACT  Null");
			//	System.out.println("relname1:"+relname);
				allRel = dbutil.getAllRelease(relname);
				session.removeAttribute("allRelVector");
				session.setAttribute("allRelVector",allRel);

				

			}
			else if("addRow".equals(act))
			{
				allRel =(Vector) session.getAttribute("allRelVector");
				
				if((Vector) session.getAttribute("temVector")== null)
				{
					System.out.println("Its null for addRow******* ------------------------> :");
		//			System.out.println("Its null"+(Vector) session.getAttribute("temVector"));
					tempVo = new ReleaseVO();
					tempVo.setReleaseName((String)request.getParameter("releaseName"));
					String checkstr = (String)request.getParameter("objectName");
		//			System.out.println("check str >>>>>>>"+checkstr);
					tempVo.setObjName(dbutil.RemoveWhiteSpace(checkstr));
					tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
				//	tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
					tempVo.setUserUpdated(userid);
					tempVo.setContactPerson(contactPerson);		

					
					allRel = dbutil.getAllRelease(tempVo.getReleaseName());
					if( dbutil.validVo(allRel,tempVo))	
					{
				//		System.out.println("::Int ITS VALID");
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);

						System.out.println( "------------------------------> 2:");
						tempVo = null;
					}
					else
					{
					%>
						<script>
						alert("This Object already exists for selected release, Can not add same object twice !!");
						</script>
					
					<%	//  System.out.println("::Int ITS not VALID");

					}
				
					String checkforextraindex = request.getParameter("extraIndex")==null?"":request.getParameter("extraIndex");
					checkforextraindex = checkforextraindex.trim();
					
					if(!(checkforextraindex.equals("") || checkforextraindex.equals("NOTSET"))){
						tempVo = new ReleaseVO();
						tempVo.setReleaseName((String)request.getParameter("releaseName"));
						tempVo.setDBName((String)request.getParameter("dBName"));
						checkstr = (String)request.getParameter("extraIndex");
						System.out.println("check str >>>>>>>"+checkstr);
						tempVo.setObjName(dbutil.RemoveWhiteSpace(checkstr));
				//		System.out.println("check str >>>>>>>"+dbutil.RemoveWhiteSpace(checkstr));
						tempVo.setObjType("New Index");
						tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
					//	tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
						tempVo.setUserUpdated(userid);
						tempVo.setContactPerson(contactPerson);		
						tempVo.setSqLQuery((String)request.getParameter("sqlquery"));
						tempVo.setArtfactID((String)request.getParameter("artId"));

					//  CR Details
					
						tempVo.setAppScreenName((String)request.getParameter("AppScreenName")==null?"":request.getParameter("AppScreenName"));
						tempVo.setAppReportName((String)request.getParameter("AppReportName")==null?"":request.getParameter("AppReportName"));
						tempVo.setPurpose((String)request.getParameter("Purpose")==null?"":request.getParameter("Purpose"));
						tempVo.setDaysTimes((String)request.getParameter("DaysTimes")==null?"":request.getParameter("DaysTimes"));
						tempVo.setDependencies((String)request.getParameter("Dependencies")==null?"":request.getParameter("Dependencies"));
						tempVo.setBusNotification((String)request.getParameter("BusNotification")==null?"":request.getParameter("BusNotification"));
						tempVo.setAudience((String)request.getParameter("Audience")==null?"":request.getParameter("Audience"));
						tempVo.setFAQ((String)request.getParameter("FAQ")==null?"":request.getParameter("FAQ"));
						tempVo.setNotes((String)request.getParameter("Notes")==null?"":request.getParameter("Notes"));
						tempVo.setEscProcedure((String)request.getParameter("EscProcedure")==null?"":request.getParameter("EscProcedure"));


						
						allRel = dbutil.getAllRelease(tempVo.getReleaseName());
					
			//			System.out.println("::Int ITS VALID");
						if( dbutil.validVo(allRel,tempVo))	
						{
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);
						tempVo = null;
						}else{
						%>
						<script>
						alert("Index already entered by someone for selected release, So No need to add again. You can proceed.. Thanks");
						</script>
					
						<%	//  System.out.println("::Int ITS not VALID");
						
						}				
					}

					
				}
				else
				{
				//	System.out.println("Its NOT null"+(Vector) session.getAttribute("temVector"));
					tempVo = new ReleaseVO();
					tempVector = (Vector) session.getAttribute("temVector");
					tempVo.setReleaseName((String)request.getParameter("releaseName"));
					tempVo.setDBName((String)request.getParameter("dBName"));
					tempVo.setObjName(dbutil.RemoveWhiteSpace((String)request.getParameter("objectName")));
					tempVo.setObjType((String)request.getParameter("objectType"));
					tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
				//	tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
					tempVo.setUserUpdated(userid);
					tempVo.setContactPerson(contactPerson);		
					tempVo.setSqLQuery((String)request.getParameter("sqlquery"));
					tempVo.setArtfactID((String)request.getParameter("artId"));

					// CR Details

					tempVo.setAppScreenName((String)request.getParameter("AppScreenName")==null?"":request.getParameter("AppScreenName"));
					tempVo.setAppReportName((String)request.getParameter("AppReportName")==null?"":request.getParameter("AppReportName"));
					tempVo.setPurpose((String)request.getParameter("Purpose")==null?"":request.getParameter("Purpose"));
					tempVo.setDaysTimes((String)request.getParameter("DaysTimes")==null?"":request.getParameter("DaysTimes"));
					tempVo.setDependencies((String)request.getParameter("Dependencies")==null?"":request.getParameter("Dependencies"));
				    tempVo.setBusNotification((String)request.getParameter("BusNotification")==null?"":request.getParameter("BusNotification"));
					tempVo.setAudience((String)request.getParameter("Audience")==null?"":request.getParameter("Audience"));
					tempVo.setFAQ((String)request.getParameter("FAQ")==null?"":request.getParameter("FAQ"));
					tempVo.setNotes((String)request.getParameter("Notes")==null?"":request.getParameter("Notes"));
					tempVo.setEscProcedure((String)request.getParameter("EscProcedure")==null?"":request.getParameter("EscProcedure"));




					allRel = dbutil.getAllRelease(tempVo.getReleaseName());
					
					if(dbutil.validVo(tempVector,tempVo) && dbutil.validVo(allRel,tempVo))
					{
				//		System.out.println("ITS VALID");
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);
						tempVo = null;
					}
					else
					{
					%>
						<script>
						alert("This Object already exists for selected release, Can not add same object twice !!");
						</script>

					<%
				//		System.out.println("ITS not VALID");
					}


					String checkforextraindex = request.getParameter("extraIndex")==null?"":request.getParameter("extraIndex");
					checkforextraindex = checkforextraindex.trim();
					
					if(!(checkforextraindex.equals("") || checkforextraindex.equals("NOTSET"))){
						tempVo = new ReleaseVO();
						tempVo.setReleaseName((String)request.getParameter("releaseName"));
						tempVo.setDBName((String)request.getParameter("dBName"));
						String checkstr = (String)request.getParameter("extraIndex");
				//		System.out.println("check str >>>>>>>"+checkstr);
						tempVo.setObjName(dbutil.RemoveWhiteSpace(checkstr));
				//		System.out.println("check str >>>>>>>"+dbutil.RemoveWhiteSpace(checkstr));
						tempVo.setObjType("New Index");
						tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
					//	tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
						tempVo.setUserUpdated(userid);
						tempVo.setContactPerson(contactPerson);							
						tempVo.setSqLQuery((String)request.getParameter("sqlquery"));
						tempVo.setArtfactID((String)request.getParameter("artId"));
					
						// CR details

						tempVo.setAppScreenName((String)request.getParameter("AppScreenName")==null?"":request.getParameter("AppScreenName"));
						tempVo.setAppReportName((String)request.getParameter("AppReportName")==null?"":request.getParameter("AppReportName"));
						tempVo.setPurpose((String)request.getParameter("Purpose")==null?"":request.getParameter("Purpose"));
						tempVo.setDaysTimes((String)request.getParameter("DaysTimes")==null?"":request.getParameter("DaysTimes"));
						tempVo.setDependencies((String)request.getParameter("Dependencies")==null?"":request.getParameter("Dependencies"));
						tempVo.setBusNotification((String)request.getParameter("BusNotification")==null?"":request.getParameter("BusNotification"));
						tempVo.setAudience((String)request.getParameter("Audience")==null?"":request.getParameter("Audience"));
						tempVo.setFAQ((String)request.getParameter("FAQ")==null?"":request.getParameter("FAQ"));
						tempVo.setNotes((String)request.getParameter("Notes")==null?"":request.getParameter("Notes"));
						tempVo.setEscProcedure((String)request.getParameter("EscProcedure")==null?"":request.getParameter("EscProcedure"));



						allRel = dbutil.getAllRelease(tempVo.getReleaseName());
					
				//		System.out.println("::Int ITS VALID");
						if(dbutil.validVo(tempVector,tempVo) && dbutil.validVo(allRel,tempVo))
						{
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);
						tempVo = null;
						}else{
							
						%>
						<script>
						alert("Index already entered by someone for selected release, So No need to add again. You can proceed.. Thanks");
						</script>
						<%	//  System.out.println("::Int ITS not VALID");
						
						}
										
					}

				}

			}
			else if("delRow".equals(act))
			{
				String delNo = (String) request.getParameter("delNumber");
				
				if(delNo != null)
				{
					int deleteNum = Integer.parseInt(delNo);
				
					tempVector =(Vector) session.getAttribute("temVector");
					if(tempVector != null && tempVector.size()>0){
					tempVector.remove(deleteNum);
					session.removeAttribute("temVector");
					session.setAttribute("temVector",tempVector);
					}

				}
			}
			else if("save".equals(act))
			{
			//		System.out.println("^^^^^^^^^^^^^^^^^^^^^^");
					tempVector =(Vector) session.getAttribute("temVector");
					if(tempVector != null && tempVector.size()>0){

						System.out.println("tempVector is not null >>>>>>>");
						dbutil.saveArtfact(tempVector);
				//		dbutil.sendEmailForIQChanges(tempVector);
						session.removeAttribute("temVector");
				//		System.out.println("relname2"+relname);
						 allRel = dbutil.getAllRelease(relname);
						session.removeAttribute("allRelVector");
						session.setAttribute("allRelVector",allRel);
					
					}
					else
					{
						System.out.println("tempVector is  null >>>>>>>");
						
				
					}


			}
				else if("saveandsend".equals(act))
			{
			//	System.out.println("save and send");
				String sender ="";
				String mailserver="";
				String header ="";
				String extraEmail = (request.getParameter("extraEmail")==null || request.getParameter("extraEmail").trim().equals(""))?"":request.getParameter("extraEmail");
			//	System.out.println("userid2 :"+userid);
			//	extraEmail = extraEmail.trim().equals{""}?userid:extraemail;
				 try {
				//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
					Properties property = new Properties();
					//File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
					File propfile = new File("STtracker.properties");
					InputStream in = new FileInputStream(propfile);
					property.load(in);
					sender = property.getProperty("RelMailSender")==null?"raman.kapil@db.com":property.getProperty("RelMailSender");
			//		System.out.println("sender " +  sender);
					mailserver = property.getProperty("MailServer");
					header= property.getProperty("AddRelHeader")==null?"@@ Added New Database Object/s for Release @@":property.getProperty("AddRelHeader");
			//		System.out.println("RelHeader " +  header);

					MailClass mailclass= new MailClass(mailserver);
					StringBuffer content = new StringBuffer();
					//String sender;
		
					
					ArrayList maillist = new ArrayList();
					maillist=dbutil.getRelMailList();

					extraEmail = extraEmail.trim();
					StringTokenizer st = new StringTokenizer(extraEmail,",");
					int totaltoken = st.countTokens();
					
					int size = maillist.size(); 	
					String receive[] = new String[size+totaltoken+1];
			//		System.out.println("size" + size);
					receive[0] = userid;
					int j=0;
					for(int i=0;i<size;i++)
					{
						MailListVO maillistvo = (MailListVO) maillist.get(i);
						receive[i+1]=maillistvo.getEmail();
			//			System.out.println("rec " + receive[i]);
						j = i+1;
					}
			//		System.out.println("check 1 >");
					while(st.hasMoreElements()){
			//			System.out.println("check 1.1 >");
						receive[++j] = st.nextToken();
			//			System.out.println("check 1.2 >");
					}
			//		System.out.println("check 2 >");
					content.append("The following database objects has been added for Release. \t\t\t\t\t\t\t");
					content.append("\n\n\n");
					tempVector =(Vector) session.getAttribute("temVector");
					if(tempVector != null )
					{
						for(int i=0;i<tempVector.size();i++)
						{
							ReleaseVO relvo =(ReleaseVO) tempVector.elementAt(i);
							content.append("\n"+(i+1)+"\tRelease Name : ");
							content.append(relvo.getReleaseName());
							content.append("\n\tDB Name : ");
							content.append(relvo.getDBName());
							content.append("\n\tObject Name : ");
							content.append(relvo.getObjName());
							content.append("\n\tObject Type : ");
							content.append(relvo.getObjType());
							content.append("\n\tUser : ");
							content.append(relvo.getUserUpdated());

							content.append("\n\n\n");


						}

					}
					

					content.append("-------------------------------------------------------------------------------------------------------------------");
					content.append("\n\n");
					content.append("System generated mail, DO NOT REPLY.");
					content.append("\nKindly contact Raman Kapil (raman.kapil@db.com) for more detail or any information.");
					
					dbutil.saveRelease(tempVector);
					dbutil.sendEmailForIQChanges(tempVector);
					session.removeAttribute("temVector");


			//		System.out.println("relname3"+relname);
					allRel = dbutil.getAllRelease(relname);
					session.removeAttribute("allRelVector");
					session.setAttribute("allRelVector",allRel);
					
					saveflag=true;
				%>
					
			<!--	<table width="750">		
					<tr>
					<td class='smalltext'><font color='red'>Saved Successfully </font></td>
					<td class='smalltext'><a href="mainpage.jsp" > Back to Main Page</a></td>
					</tr>
					 
					</table>
			-->
				<%
					

					//mailclass.postMail(receive,header,content.toString(),sender);
					

				%>
								
				<!--	
				<table width="750">		
				<td class='smalltext'><font color='red'>Mail Sent Successfully </font></td>
				</table>
				-->
					

				<%		
					sendmailfailflag = false;
				 }
				catch(Exception e)
				{
					System.out.println("Exception while sending mail :"+e);
					sendmailfailflag = true;
					
				%>	

				<!--
					<table width="750">		
	
						<td class='smalltext'><font color='red'>Could not connect to SMTP host. Sending failed.</font></td>
					</table>
				-->	
				
					
				<%	

				}
			}


			boolean releaseExecutionFlag = false;
			releaseExecutionFlag = dbutil.checkUserRightForRelease(userid);

		%>
<!--			
			<a>&nbsp&nbsp</a>
			<a>&nbsp&nbsp</a>

			<%if(releaseExecutionFlag==true){%>
			<a href="ReleaseAdmin.jsp">Release Admin Page</a>
			<%}%>
-->
						
						
						
						
						<table cellspacing="0" cellpadding="0" width="95%" 
                          border="0">
                            <tbody>
                              <tr class="style2">
                                <td class="marginscontact"><span class="contentbold1">Artact- Basic Details<br />
                                  <br />
                                </span></td>
                                <td class="marginscontact">&nbsp;</td>
                                <td class="marginscontact">&nbsp;</td>
                              </tr>
                              <tr class="style2">
                                <td class="marginscontact" width="44%"><div align="right"><span class="normalcontent"><span class="content">Release Name</span> <span 
                              class="photo_name">:</span></span></div></td>
                                <td class="marginscontact" width="3%">&nbsp;</td>
                                <td class="marginscontact" width="53%">
								
								<select name=releaseName  >
								
													
								<% 															
									Vector relNameVector = dbutil.getReleaseName(userid);
									for(int i=0;i<relNameVector.size();i++)
									{
										ReleaseVO relbean =(ReleaseVO)relNameVector.elementAt(i); 
								%>
	
										<option value= '<%=	relbean.getReleaseName()%>' 									<%=relNameforIndx.equals(relbean.getReleaseName())?"selected":""%>	
										>
										<%= relbean.getReleaseName()%> 
										</option>
					
								<%	}
								%>
								</select>
								</td>
                              </tr>
                              <tr class="style2">
                                <td class="marginscontact"><div align="right">Descr:</div></td>
                                <td class="marginscontact">&nbsp;</td>
                                <td class="marginscontact">
								<input type="text" class="box" id ="objectName" name="objectName" size="31" value='<%= tempVo == null?"": tempVo.getObjName()%>'>
								</td>
                              </tr>
                              <tr>
                                <td valign="top" class="marginscontact"><div align="right">Contact Person's Email:</div></td>
                                <td valign="top" class="marginscontact">&nbsp;</td>
                                <td class="marginscontact" valign="center">
									<input type="text" class="box" name="userUpdated" id ="userUpdated" size="31" value=<%=userid%> <% out.println("disabled"); %>
									> 
							  </td>
                              </tr>
							  <input type=hidden name=dateUpdated value='<%= tempVo == null? todate: tempVo.getDateUpdated()%>' > 
                              <tr>
                                <td valign="top" class="content">&nbsp;</td>
                                <td valign="top" class="marginscontact">&nbsp;</td>
                                <td class="marginscontact" valign="center">
								<input type=button class=whitebutton name=addButton value=Add  onclick='return addRow()'>
									&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<font  color="#FF6600"> * - Mandatory Field</font>
								
								</td>
                              </tr>
                            </tbody>
                          </table></td>
                          <td background="./images/login_06.jpg"><img src="./images/login_06.jpg" width="12" height="224" alt="" /></td>
                        </tr>
                        <tr>
                          <td><img src="./images/login_07.jpg" width="11" height="16" alt="" /></td>
                          <td background="./images/login_08.jpg" bgcolor="#F3F7FA"><img src="./images/login_08.jpg" width="384" height="16" alt="" /></td>
                          <td><img src="./images/login_09.jpg" width="12" height="16" alt="" /></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>
					  	<% 
						tempVector =(Vector) session.getAttribute("temVector");
						if( tempVector != null && tempVector.size() >0)
						{
						 %>
					  <table width="100%" border="1" cellspacing="1" cellpadding="1">
								<tr bgcolor="#ADDFFF">
								  <td width="14%" class="contentbold1">Release Name </td>
								  <td width="11%" class="contentbold1">Descr</td>
								  <td width="21%" class="contentbold1">Contact Person</td>
								</tr>                 
									<%
										for(int i=0 ;i<tempVector.size();i++)
										{
											ReleaseVO dispVo = (ReleaseVO)tempVector.elementAt(i);
									%>
											<tr  >	
												<td class=bodyblue > <%= dispVo.getReleaseName()  %> </td>
												<td class=bodyblue > <%= dispVo.getObjName()  %> </td>
												<td class=bodyblue > <%= dispVo.getUserUpdated()  %> </td>
											</tr>
											
									<%	}
									%>
                      </table>
					  
					  </td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="25%" height="26"><div align="right"><span class="marginscontact">
                              <input type=button  class=whitebutton value=Save onClick="save()"/>
                          </span></div></td>         
                        </tr>
                      </table></td>
                    </tr>
                  </table>

				  <% } %>
			<% 
				if("save".equals(act))
				{
					session.removeAttribute("CONTACTPERSONVECTOR");
			%>
					<table width="750">		
					<tr>
					<td class='smalltext'><font color='blue'>Saved Successfully </font></td>
					
					</tr>
					 
					</table>
			<%	}
					%>


				<% 
				if("saveandsend".equals(act) && saveflag==true)
				{
					session.removeAttribute("CONTACTPERSONVECTOR");
			%>
					<table width="750">		
					<tr>
					<td class='smalltext'><font color='blue'>Saved Successfully </font></td>
					
					</tr>
					 
					</table>
			<%	}
					%>

						<% 
				if("saveandsend".equals(act) && sendmailfailflag==true)
				{
					session.removeAttribute("CONTACTPERSONVECTOR");
			%>
					<table width="750">		
					<tr>
					<td class='smalltext'><font color='red'>Could not connect to SMTP host. Sending mail failed !</font></td>
					
					</tr>
					 
					</table>
			<%	}
				if("saveandsend".equals(act) && sendmailfailflag==false)
				{  	
					session.removeAttribute("CONTACTPERSONVECTOR");

					%>
						<table width="750">		
					<tr>
					<td class='smalltext'><font color='blue'>Mail Sent Successfully for added Objects</font></td>
					
					</tr>
					 
					</table>

			<%  } %>
                    <br />
                      <br />
                      <br />
                    <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br />
                      <br /></td>
                </tr>
                
            </table></td>
          </tr>
          <tr>
            <td height="19" colspan="2" valign="top" bgcolor="#CCCCCC"><span class="contentwhitesatheesh">&copy;2010 Joju's Software. All rights reserved.</span></td>
          </tr>
      </table></td>
    </tr>
  </table>
</center>
</form>
</body>
</html>
<% }
}
catch(Exception e) {
				e.printStackTrace();
		}

		%>
